package com.smart.sms.config;


import com.aliyun.dysmsapi20170525.Client;
import com.aliyun.teaopenapi.models.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

@Configuration
public class AliSmsConfig {
    @Resource
    AliSmsProperties properties;

    @Bean
    public Client config() throws Exception {
        Config config = new Config()
                .setAccessKeyId(properties.getAccessKeyId())
                .setAccessKeySecret(properties.getAccessKeySecret());
        // 访问的域名
        config.endpoint = properties.getEndpoint();
        return new Client(config);
    }

}
